
//
//  OilMapViewController.m
//  carcareIOS
//
//  Created by wr on 16/4/19.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "OilMapViewController.h"

#import "MapLocationSimple.h"
#import "FuelMgr.h"

@interface OilMapViewController ()

//地图
@property (nonatomic, strong) MapLocationSimple * mapLoc;

@end

@implementation OilMapViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"加油站";
    __weak __typeof(self) wself = self;
    self.mapLoc = [[MapLocationSimple alloc] init];
    self.mapLoc.mapView.frame = CGRectMake(0, 0, __MAIN_WIDTH, __MAIN_HEIGHT + 30);
    self.mapLoc.mapView.userInteractionEnabled = NO;
    
    self.mapLoc.calloutView = [LocAnnotationView simpleCalloutView];
    self.mapLoc.CalloutViewUpdate = ^(UIView *view, id<MAAnnotation> annotation){
        LocSimpleCalloutView *callout = (LocSimpleCalloutView *)view;
        callout.title = [FuelMgr sharedInstance].choiceRecordModel.CDT;
        callout.subTitle = [FuelMgr sharedInstance].choiceRecordModel.GSTATION_NAME;
    };
    self.mapLoc.mapDidTouch = ^()
    {
        [wself.scrollView endEditing:YES];
    };
    self.mapLoc.coordinate = CLLocationCoordinate2DMake([[FuelMgr sharedInstance].choiceRecordModel.latitude doubleValue], [[FuelMgr sharedInstance].choiceRecordModel.longitude doubleValue]);
    [self.mapLoc showLocation];
    [self.view addSubview:self.mapLoc.mapView];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
